package tt.langchain4j.model;

import dev.langchain4j.model.embedding.EmbeddingModel;
import dev.langchain4j.model.ollama.OllamaEmbeddingModel;
import tt.langchain4j.Constants;
import tt.langchain4j.core.BufferSupplier;

import java.time.Duration;
import java.util.function.Supplier;

public enum EmbeddingModels {



    QUENTINZ_BGE_LARGE_ZH_V15("quentinz/bge-large-zh-v1.5") ,


    ;

    public static final EmbeddingModels DEFAULT = QUENTINZ_BGE_LARGE_ZH_V15;

    private final BufferSupplier<EmbeddingModel> modelSupplier;

    EmbeddingModels( String modelName ) {
        this(()->OllamaEmbeddingModel.builder()
                .baseUrl(Constants.OLLAMA_URL)
                .modelName(modelName)
                .timeout(Duration.ofMinutes(5))
                .build()
        );
    }

    EmbeddingModels(Supplier<EmbeddingModel> modelSupplier ) {
        this.modelSupplier = new BufferSupplier<>(modelSupplier);
    }

    public EmbeddingModel model() {
        return modelSupplier.get();
    }


}
